import sys
import os
import pandas as pd
import numpy as np
import sqlite3


def csv_to_sqlite(file_name, sep=None):
    if sep == None:

        sep = ','

    else:

        sep = sep

    conn = sqlite3.connect('sqlite3db')

    df = pd.read_csv(file_name, sep=sep)

    df.to_sql(file_name.replace('，', '_'), conn)


if __name__ == '__main__':


    # try:
    #
    #     csv_to_sqlite(sys.argv[1], sys.argv[2])
    #
    # except IndexError:
    #
    #     csv_to_sqlite(sys.argv[1])

    file_name='https://raw.githubusercontent.com/justmarkham/DAT8/master/data/chipotle.tsv'
    csv_to_sqlite(file_name=file_name,sep='\t')
    print('存储成功')
